<?php 
$categories = $mvc->getObject(CategoryService::CATEGORY);
$subcategories = $mvc->getObject(SubCategoryService::SUBCATEGORY);
$regions = $mvc->getObject(RegionService::REGIONS);
$remind_regions = $mvc->getObject(RemindService::REGION_ID);
$status = $mvc->getObject(ContentController::STATUS);
$data = $mvc->getObject(ContentController::RESULT);
$errors = $mvc->getObject(ContentController::ERROR);
$plans = $mvc->getObject(PlanService::PLAN);
?>
<h2>_i18n{My Notification}</h2>
<div class="unitABlock">
	<div class="unitInfo unitRtf">
		<?php echo StaticBlockService::getBlock(21); ?>
	</div>
</div>
<ul class="viewIList">
	<li class="itemNewB"><a href="#" title="_i18n{New notification}">_i18n{New notification}</a></li>
</ul>
<h2>Notification</h2>
<div class="unitABlock unitABlockLast">
	<?php if (isset($status )){?>
		<div class="itemOk">
			<p>_i18n{Successfully Saved}</p>
		</div>
	<?php } ?>
	<?php if (isset($errors )){?>
		<div class="itemWarning">
			<ul>
				<li><?php echo $errors?></li>
			</ul>
		</div>
	<?php } ?>
	<div class="unitNtHide">
		<!-- sample on -->
		<div class="unitNt">
			<div class="innerP">
				<div class="itemForm itemFirst">
					<label for="frmCc">_i18n{Category}:</label>
					<div class="itemData">
						<select id="frmCc" name="category" class="gCategory">
		<?php					if (isset($categories) && $categories!=NULL){ 
									foreach($categories as $key=>$category){ ?>
										<option value="<?php echo $category[CategoryService::ID] ?>"><?php echo $category[CategoryService::CAT_NAME] ?></option>
		<?php 						} 
								} ?>
						</select>
					</div>
				</div>
				<div class="itemForm">
					<label for="frmCs">_i18n{SubCategory}:</label>
					<div class="itemData">
						<select id="frmCs" name="subcategory" class="gSubCategory">
		<?php					if (isset($subcategories) && $subcategories!=NULL){ 
									foreach($subcategories as $key=>$subcategory){ 
										if ($subcategory[SubCategoryService::CAT_ID] == $categories[0][CategoryService::ID]){?>
											<option value="<?php echo $subcategory[SubCategoryService::ID] ?>"><?php echo $subcategory[SubCategoryService::SUBCAT_NAME] ?></option>
		<?php 							}
									}
								} ?>
						</select>
					</div>
				</div>
				<div class="itemForm">
					<label for="frmCp">_i18n{Price} :</label>
					<div class="itemData">
						<select id="frmCp" name="plan">
		<?php					if (isset($plans) && $plans!=NULL){ 
									foreach($plans as $key=>$plan){ ?>
										<option value="<?php echo $plan[PlanService::ID] ?>">
											<?php if ($plan[PlanService::TENDER_TO]!=0) { ?>
												_i18n{up to} <?php echo $plan[PlanService::TENDER_TO] ?> &euro;
											<?php } else { ?>
											 	_i18n{up to} <?php echo $plans[$key-1][PlanService::TENDER_TO] ?> &euro; _i18n{and more} 
											 <?php } ?>
										</option>
		<?php 						}
								} ?>
						</select>
					</div>
				</div>
			</div>
			<div class="linkDelete">
				<a href="#" title="_i18n{Remove notification}">_i18n{Remove notification}</a>
			</div>
		</div>
		<!-- sample off -->
	</div>
	<form action="/communication.html" method="post">
		<div class="unitNtEmpty hideElement">
			<p>_i18n{Empty notification}</p>
		</div>
<?php 
	if(isset($data) && $data!=NULL && count($data)>0) {
		foreach($data as $data_key=>$remind){
?>
		<div class="unitNt">
			<div class="innerP">
				<div class="itemForm itemFirst">
					<label for="frmCc<?php echo $data_key; ?>">_i18n{Category}:</label>
					<div class="itemData">
						<select id="frmCc<?php echo $data_key; ?>" name="category[<?php echo $data_key; ?>]" class="gCategory">
							<option selected="selected" value="<?php echo $remind[RemindService::CATEGORY_ID]?>"><?php echo $remind[CategoryService::CAT_NAME];?></option>
<?php			if (isset($categories) && $categories!=NULL){ 
					foreach($categories as $key=>$category){ 
						if ($category[CategoryService::ID]!=$remind[RemindService::CATEGORY_ID]){ ?>
							<option value="<?php echo $category[CategoryService::ID] ?>"><?php echo $category[CategoryService::CAT_NAME] ?></option>
<?php 					}
					} 
				} ?>
						</select>
					</div>
				</div>
				<div class="itemForm">
					<label for="frmCs<?php echo $data_key; ?>">_i18n{Sub-Category}:</label>
					<div class="itemData">
						<select id="frmCs<?php echo $data_key; ?>" name="subcategory[<?php echo $data_key; ?>]" class="gSubCategory">
							<option selected="selected" value="<?php echo $remind[RemindService::SUBCATEGORY_ID]?>"><?php echo $remind[SubCategoryService::SUBCAT_NAME];?></option>
<?php			if (isset($subcategories) && $subcategories!=NULL){ 
					foreach($subcategories as $key=>$subcategory){ 
						if ($subcategory[SubCategoryService::ID]!=$remind[RemindService::SUBCATEGORY_ID] && $subcategory[SubCategoryService::CAT_ID]==$remind[RemindService::CATEGORY_ID]){ ?>
							<option value="<?php echo $subcategory[SubCategoryService::ID] ?>"><?php echo $subcategory[SubCategoryService::SUBCAT_NAME] ?></option>
<?php 					}
					} 
				} ?>								
						</select>
					</div>
				</div>
				<div class="itemForm">
					<label for="for="frmCp<?php echo $data_key; ?>">_i18n{Price} :</label>
					<div class="itemData">
						<select id="frmCp<?php echo $data_key; ?>" name="plan[<?php echo $data_key; ?>]">
							<option selected="selected" value="<?php echo $remind[RemindService::PLAN_ID]?>">
								<?php if ($remind[PlanService::TENDER_TO]!=0) { ?>
									_i18n{up to} <?php echo $remind[PlanService::TENDER_TO] ?> &euro;
								<?php } else { ?>
								 	_i18n{all prices} 
								 <?php } ?>
							</option>
		<?php					if (isset($plans) && $plans!=NULL){ 
									foreach($plans as $key=>$plan){ 
									if ($plan[PlanService::ID]!=$remind[RemindService::PLAN_ID]){ ?>
										<option value="<?php echo $plan[PlanService::ID] ?>">
											<?php if ($plan[PlanService::TENDER_TO]!=0) { ?>
												_i18n{up to} <?php echo $plan[PlanService::TENDER_TO] ?> &euro;
											<?php } else { ?>
											 	_i18n{up to} <?php echo $plans[$key-1][PlanService::TENDER_TO] ?> &euro; _i18n{and more} 
											 <?php } ?>
										</option>
		<?php 						}
									}
								} ?>
						</select>
					</div>
				</div>
			</div>
			<div class="linkDelete">
				<a href="#" title="Remove notification">Remove notification</a>
			</div>
		</div>
<?php } } ?>
		<dl class="viewNtList">
			<dt><span>Region:</span></dt>
			<dd>
				<ul>
<?php foreach($regions as $key=>$region){ ?> 
					<li>
						<input 
						<?php if (isset($remind_regions)&&$remind_regions!=NULL ){ foreach($remind_regions as $key=>$remind_regions_item){ ?> 
						<?php echo $remind_regions_item[RemindService::REGION_ID]==$region[RegionService::ID] ? 'checked' : NULL; }}?>
						
						id="frmR<?php echo $region[RegionService::ID]; ?>" type="checkbox" class="inpChk" name="region[<?php echo $region[RegionService::ID]; ?>]" value="<?php echo $region[RegionService::ID]; ?>"/>
						<label for="frmR<?php echo $region[RegionService::ID]; ?>"><?php echo $region[RegionService::REGION_NAME]; ?></label>
					</li>
<?php } ?>
				</ul>
			</dd>
		</dl>
		<div class="unitBtn">
			<button name="save"><span><strong>_i18n{Save}</strong></span></button>
		</div>
	</form>
</div>

